<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>电影信息添加页面</title>
<link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/icon.css" />
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>

<script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>
<script type="text/javascript">

	function submitData(){
		$("#fm").form("submit",{
			url:"/admin/film/save",
			onSubmit:function(){
				var content=CKEDITOR.instances.content.getData();
				if(content==""){
					$.messager.alert("系统提示","内容不能为空！");
					return false;
				}
				return $(this).form("validate");
			},
			success:function(result){
				var result=eval('('+result+')');
				if(result.success){
					$.messager.alert("系统提示","保存成功！");
					resetValue();
				}else{
					$.messager.alert("系统提示","保存失败！");
				}
				
			}
		});
	}
	
	function resetValue(){
		$("#name").val("");
		$("#title").val("");
		$("#imageFile").val("");
		$("#yes").prop("checked",true);
		CKEDITOR.instances.content.setData("");
	}
</script>
</head>
<body style="margin: 10px">
<div id="p" class="easyui-panel" title="添加电影" style="padding: 10px">
	<form id="fm" method="post" enctype="multipart/form-data">
		<table cellspacing="20px">
			<tr>
				<td width="80px">电影名称：</td>
				<td>
					<input type="text" id="name" name="name" style="width: 400px" class="easyui-validatebox" required="true"/>
				</td>
			</tr>
			<tr>
				<td width="80px">标题：</td>
				<td>
					<input type="text" id="title" name="title" style="width: 400px" class="easyui-validatebox" required="true"/>
				</td>
			</tr>
			<tr>
				<td width="80px">电影图片：</td>
				<td>
					<input type="file" id="imageFile" name="imageFile" />
				</td>
			</tr>
			<tr>
				<td width="80px">设置热门：</td>
				<td>
					<input type="radio" id="yes" value="1" name="hot" checked="checked"/>是&nbsp;
					<input type="radio" id="no" value="0" name="hot"/>否&nbsp;
				</td>
			</tr>
			<tr>
				<td valign="top">内容：</td>
				<td>
					<textarea id="content" name="content" rows="30" cols="80"></textarea>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<a href="javascript:submitData()" class="easyui-linkbutton" data-options="iconCls:'icon-submit'">发布</a>
				</td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
	CKEDITOR.replace("content");
</script>
</body>
</html>